package com.haopt.clock.controller;

import com.haopt.clock.dto.ResultDTO;
import com.haopt.clock.service.ApplicationService;
import com.haopt.clock.vo.ReqApplicationPageVO;
import com.haopt.clock.vo.ResApplicationDetailVO;
import com.haopt.clock.vo.ResIdVO;
import com.haopt.clock.vo.ResPageVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author haopt
 * @version 1.0
 * @ClassName ApplicationController
 * @Description TODO
 * @date 2021/3/22 15:33
 */
@RestController
@RequestMapping("/application")
public class ApplicationController {

    @Autowired
    private ApplicationService applicationService;

    /**
     * 申请成为管理员
     *
     * @return
     */
    @GetMapping("/application")
    public ResultDTO<ResIdVO> application(@RequestParam("id") String id) {
        return applicationService.application(id);
    }

    /**
     * 获取列表
     * @return
     */
    @PostMapping("/listOfPage")
    public ResultDTO<ResPageVO<ResApplicationDetailVO>> listOfPage(@RequestBody ReqApplicationPageVO vo) {
        return applicationService.listOfPage(vo);
    }

    /**
     * 权限审核
     * @return
     */
    @GetMapping("/review")
    public ResultDTO review(@RequestParam("id")String id,@RequestParam("state")Integer state) {
        return applicationService.review(id,state);
    }
}
